

package com.hazelcast.scheduledexecutor.impl;

import com.hazelcast.scheduledexecutor.AutoDisposableTask;

import java.util.concurrent.Callable;

public class AutoDisposableTaskDecorator<V> extends AbstractTaskDecorator<V> implements AutoDisposableTask {


    AutoDisposableTaskDecorator() {
    }

    private AutoDisposableTaskDecorator(Runnable runnable) {
        super(runnable);
    }

    private AutoDisposableTaskDecorator(Callable<V> callable) {
        super(callable);
    }

    public static Runnable autoDisposable(Runnable runnable) {
        return new AutoDisposableTaskDecorator(runnable);
    }

    public static <V> Callable<V> autoDisposable(Callable<V> callable) {
        return new AutoDisposableTaskDecorator<>(callable);
    }

    @Override
    public int getClassId() {
        return ScheduledExecutorDataSerializerHook.AUTO_DISPOSABLE_TASK_DECORATOR;
    }
}
